package com.project.estate.activity.controller;

import com.project.estate.activity.service.ActivityService;
import com.project.estate.commons.bean.Activity;
import com.project.estate.commons.config.JsonResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/activity")
public class ActivityController {

    @Resource
    private ActivityService activityService;

    @PostMapping("/add_activity")
    public JsonResult addActivity(Activity activity) {
        return activityService.addActivity(activity);
    }

    //删除
    @DeleteMapping("/delete_activity/{comId}")
    public JsonResult deleteActivity(@PathVariable("comId") String comId) {
        return activityService.deleteActivity(comId);
    }

    //修改
    @PutMapping("/update_activity/{comId}")
    public JsonResult updateActivity(@PathVariable("comId") String comId, Activity activity) {
        return activityService.updateActivity(activity, comId);
    }

    //查询
    @GetMapping("/find_activity/{comId}")
    public JsonResult findActivity(@PathVariable("comId") String comId) {
        return activityService.findActivity(comId);
    }
}
